home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
amigadoslibrary
/
lock.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
813b
|
43 lines
/* Lock.c V1.0 93-03-15 */
/* ROM library: "dos.library/Lock", (All versions) */
/* Copyright 1993, Anders Bjerin, Amiga C Club */
#include <dos/dos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
UBYTE *version = "$VER: Lock 1.0";
int main( int argc, char *argv[] );
int main( int argc, char *argv[] )
{
BPTR my_lock;
/* Put an exclusive lock on a file: */
my_lock = Lock( "RAM:Score.dat", EXCLUSIVE_LOCK );
/* OK? */
if( !my_lock )
{
/* Problems, the file does not exist or someone */
/* else is using the file: */
printf( "Error! Could not lock the file!\n" );
exit( 20 );
}
else
printf( "File is locked!\n" );
/* - - - */
/* Unlock the file: */
UnLock( my_lock );
exit( 0 );
}